package com.hutra.bitmap
{
	import flash.utils.Timer;
	
	/**
	 * A Timer for frame rate-related classes.
	 * @author hunglx
	 * @version 1.0.0
	 */
	public class EnterFrame extends Timer{
		/**
		 * Stores the frame rate value.
		 * @private
		 */
		private var _fps:int;
		/**
		 * Creates a new EnterFrame instance.
		 * 
		 * @param fps The frame rate value for the EnterFrame. If this
		 *         value is smaller than 0, 24 will be used as a default.
		 */
		public function EnterFrame(fps:int = -1)
		{
			_fps = (fps > -1) ? fps : 24;
			super(Math.round(1000 / _fps), 0);
		}
		/**
		 * Returns the frame rate of the EnterFrame.
		 * 
		 * @return The frame rate of the EnterFrame.
		 */
		public function getFrameRate():int
		{
			return _fps;
		}
	}
}
